/**
 * 
 */
package server;

/**
 * @author Austin
 *
 */
public abstract class Processer implements Runnable {
	
	public abstract void process();
	public abstract int timeBetweenProcesses();
	
	public boolean running = false;
	
	/* (non-Javadoc)
	 * @see java.lang.Runnable#run()
	 * DO NOT OVERRIDE
	 */
	public void run() {
		
		while(running) {
			if(Server.shutdownServer) break;
		process();
		try {
			synchronized (this) {
			wait(timeBetweenProcesses());
			}
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
		System.out.println(getClass().getName() + " - Thread Stopped");
	}

}
